home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7146 < prev    next >
Encoding:
Text File  |  1996-08-05  |  5.3 KB  |  153 lines

  1. Path: in2.uu.net!van-bc!usenet
  2. From: Ed Sargent <ed@metaxa.wimsey.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: SPARC C++ 4.1 and STL
  5. Date: 22 Feb 1996 01:01:02 GMT
  6. Organization: I.C.B.C.
  7. Message-ID: <4ggf8e$c75@wolfe.wimsey.com>
  8. NNTP-Posting-Host: pm013.vcr.wis.net
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 1.1N (X11; I; SunOS 4.1.3_U1 sun4c)
  13. X-URL: news:comp.lang.c++
  14.  
  15. Using :
  16.  
  17.     SPARCompiler C++ 4.1 on Solaris 2.5
  18.  
  19.     HP distribution of STL (October 31, 1995)
  20.  
  21.  
  22. I believe that this compiler is supposed to support the "public version"
  23. of the STL.
  24.  
  25. I am trying to work my way through the some example programs that use the
  26. STL.  About 95% of the examples compile and run successfully.  However I am
  27. running into problems with the set and mset examples.
  28.  
  29. For example, when I try to compile the following :
  30.  
  31.  
  32. //
  33. // SET0802.CPP
  34. //
  35.  
  36. #include <iostream.h>
  37. #include "set.h"
  38.  
  39. main()
  40. {
  41.     int init[] = { 4, 10, 1, 3, 22, 1, 100, -100 };
  42.     set<int, less<int> > a( init, init + 8 );
  43.  
  44.     cout << "a contains "
  45.          << a.size()
  46.          << " elements"
  47.          << endl;
  48.  
  49.     cout << "The maximum size is "
  50.          << a.max_size()
  51.          << endl;
  52.  
  53.     cout << "a is "
  54.          << ( a.empty() ? "" : "not " )
  55.          << "empty"
  56.          << endl;
  57.  
  58.     cout << "a contains : ";
  59.     for ( set<int, less<int> >::iterator i = a.begin() ;
  60.           i != a.end() ;
  61.           i++ )
  62.         cout << *i << " ";
  63.     cout << endl;
  64.  
  65.     cout << "a reversed contains: ";
  66.     set<int, less<int> >::reverse_iterator j;
  67.     j = a.rbegin();
  68.     while ( j != a.rend() )
  69.         cout << *j++ << " ";
  70.     cout << endl;
  71.  
  72.     return 1;
  73. }
  74.  
  75.  
  76. I get :
  77.  
  78. + CC -c set0802.cpp -o set0802.o -I/project/lib/stl_book_examples -I/project/lib/stl
  79. -DMAIN 
  80. "/project/lib/stl/set.h", line 108: Warning (Anachronism): Redefining set::iterator
  81. after use in rb_tree<int, int, ident<int, int>, less<int>>::rb_tree_node.
  82. "/project/lib/stl/set.h", line 108: Note: Type "CC -migration" for more on anachronisms.
  83. "/project/lib/stl/set.h", line 38:     Where: While specializing "rb_tree<int, int,
  84. ident<int, int>, less<int>>".
  85. "/project/lib/stl/set.h", line 38:     Where: Specialized in set<int, less<int>>.
  86. "set0802.cpp", line 11:     Where: Specialized in non-template code.
  87. "/project/lib/stl/set.h", line 105: Warning (Anachronism): Redefining set::iterator
  88. after use in rb_tree<int, int, ident<int, int>, less<int>>::rb_tree_node.
  89. "/project/lib/stl/set.h", line 38:     Where: While specializing "rb_tree<int, int,
  90. ident<int, int>, less<int>>".
  91. "/project/lib/stl/set.h", line 38:     Where: Specialized in set<int, less<int>>.
  92. "set0802.cpp", line 11:     Where: Specialized in non-template code.
  93. "/project/lib/stl/set.h", line 103: Warning (Anachronism): Redefining set::iterator
  94. after use in rb_tree<int, int, ident<int, int>, less<int>>::rb_tree_node.
  95. "/project/lib/stl/set.h", line 38:     Where: While specializing "rb_tree<int, int,
  96. ident<int, int>, less<int>>".
  97. "/project/lib/stl/set.h", line 38:     Where: Specialized in set<int, less<int>>.
  98. "set0802.cpp", line 11:     Where: Specialized in non-template code.
  99. "/project/lib/stl/set.h", line 83: Warning (Anachronism): Redefining set::iterator after
  100. use in rb_tree<int, int, ident<int, int>, less<int>>::rb_tree_node.
  101. "/project/lib/stl/set.h", line 38:     Where: While specializing "rb_tree<int, int,
  102. ident<int, int>, less<int>>".
  103. "/project/lib/stl/set.h", line 38:     Where: Specialized in set<int, less<int>>.
  104. "set0802.cpp", line 11:     Where: Specialized in non-template code.
  105. "set0802.cpp", line 28: Error: Unexpected type name "set<int, less<int>>::iterator"
  106. encountered.
  107. "set0802.cpp", line 28: Error: i is not defined.
  108. "set0802.cpp", line 28: Error: Badly formed expression.
  109. "set0802.cpp", line 30: Error: i is not defined.
  110. "set0802.cpp", line 30: Error: Unexpected ")" -- Check for matching parenthesis.
  111. "set0802.cpp", line 30: Error: Use ";" to terminate statements.
  112. "set0802.cpp", line 30: Error: "}" expected instead of ")".
  113. "set0802.cpp", line 35: Error: Unexpected type name "set<int,
  114. less<int>>::reverse_iterator" encountered.
  115. "set0802.cpp", line 35: Error: j is not defined.
  116. "set0802.cpp", line 35: Error: Badly formed expression.
  117. "set0802.cpp", line 36: Error: j is not defined.
  118. "set0802.cpp", line 37: Error: j is not defined.
  119. "set0802.cpp", line 38: Error: j is not defined.
  120. 13 Error(s) and 4 Warning(s) detected.
  121. *** Error code 13
  122. make: Warning: Target `all' not remade because of errors
  123.  
  124.  
  125. However, if I comment out that last two sections of the program that use
  126. iterators, then I stil get the warnings but no errors, and the program
  127. runs OK.
  128.  
  129. Additionally, I get other errors with other examples. 
  130.  
  131. Is anybody using the public domain STL with SPARC C++ 4.1?  What are the
  132. requirments to do so successfully?
  133.  
  134. Thanks, Ed  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143. -- 
  144. ***************************************************************************
  145. *                                                                         *
  146. * Ed Sargent                                         ed@metaxa.wimsey.com *
  147. * Corporate Actuarial Dept.                                               *
  148. * Insurance Corporation of B.C.                                           *
  149. * N. Vancouver, B.C.,  Canada                                             * 
  150. *                                                                         *
  151. ***************************************************************************
  152.  
  153.